# encoding: utf-8
"""
@author: 夏洛
@QQ: 1972386194
@file: 04-json.py
"""

import json


'''
json.loads()  # json转字典
json.dumps()    字典转json
json.load()  文件操作
json.dump()
'''
data = [{
    'name': ' 王伟 ',
    'gender': ' 男 ',
    'birthday': '1992-10-18'
}]

with open('data.json', 'w', encoding='utf-8') as file:
    file.write(json.dumps(data, indent=2, ensure_ascii=False))

